-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
coreutils: Print usage to stderr. #7920
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Scripts exist that may call one of the multi-binary entry points with argument 0 set to some other value than the name of the entry point. One example is the Open vSwitch testsuite which makes use of /bin/true as an argument to the bash builtin `exec` to check whether it supports the '-a' argument [0]. In this situation coreutils will print usage on standard output, which makes unnecessary noise. Printing usage on standard error, which is customary for other tools, allows the script to succeed. 0: https://github.com/openvswitch/ovs/blob/28064e9fa50d/tests/ovs-macros.at#L199 Signed-off-by: Frode Nordahl <[email protected]>
|
GNU testsuite comparison: |
|
GNU testsuite comparison: |
|
@fnordahl As far as I can tell, GNU coreutils prints the |
Let's see, its been a while so let me see if I can remember this. The problem appears to root in the fact that many existing scripts change argv[0] when calling one of the coreutils, in this instance Example: Since the last time I looked at this coreutils appears to have changed to print this security violation instead of the usage. You also appear to be correct in that the stdout vs. stderr assertion is incorrect, not sure how I came to that conclusion. Anyway, this is a breaking change in coreutils. It appears that |
|
Interesting. On Ubuntu 26.04 (development branch) it doesn't work: The error "Security Violation..." comes from uutils coreutils itself however I haven't found it in the source code: Edit: the error comes from a Ubuntu patch ( https://git.launchpad.net/ubuntu/+source/rust-coreutils/tree/debian/patches/require-utility-to-be-invoked-at-matching-path.patch?h=applied/ubuntu/devel ): @julian-klode FYI |
Scripts exist that may call one of the multi-binary entry points with argument 0 set to some other value than the name of the entry point.
One example is the Open vSwitch testsuite which makes use of /bin/true as an argument to the bash builtin
execto check whether it supports the '-a' argument [0].In this situation coreutils will print usage on standard output, which makes unnecessary noise.
Printing usage on standard error, which is customary for other tools, allows the script to succeed.
0: https://github.com/openvswitch/ovs/blob/28064e9fa50d/tests/ovs-macros.at#L199